const express = require('express')

const app = express()

const bodyParser = require('body-parser');

app.set('secret', 'qianhaiwoertianxiadiyi');

app.use(require('cors')());
// app.use(express.json())
// 处理application/json内容格式的请求体
app.use(bodyParser.json());
app.use("/admin", express.static(__dirname + "/public/admin"))
app.use("/", express.static(__dirname + "/public/web"))
app.use('/uploads', express.static(__dirname + '/uploads'));

require('./plugins/db')(app); //这个要放前面，把所有models引用一遍
require("./routes/web")(app);

app.listen(3000, () => {
  console.log('http://localhost:3000');
})